# define MAX_FD_SIZE 30

struct VFS {
	char label[50];
	int freeList[MAX_FD_SIZE];
	struct FileDescriptor fd[MAX_FD_SIZE];
	char block[MAX_FD_SIZE][1024];
};

void mountNArray (struct VFS *header) {
	struct NArray_node *NArrayRoot = NULL;
	int i;
	for (i = 0; i < MAX_FD_SIZE; i++) {
		if(header -> freeList[i]) {
			NArrayRoot = insertNArrayNode(NArrayRoot, header -> fd[i].filePath);
		} 
	}
	printf("\nPre Order NArray:\n");
	preOrder1 (NArrayRoot);
	printf("\nIn Order NArray:\n");
	inOrder1 (NArrayRoot);
}

void mountBST (struct VFS *header) {
	struct BST_node *BSTRoot = NULL;
	int i;
	for (i = 0; i < MAX_FD_SIZE; i++) {
		if(header -> freeList[i]) {
			BSTRoot = insertBSTNode(BSTRoot, header -> fd[i].filePath);
		} 
	}
	printf("\nPre Order NArray:\n");
	preOrder2 (BSTRoot);
	printf("\nIn Order NArray:\n");
	inOrder2 (BSTRoot);
}

void mountHashTable (struct VFS *header) {
	struct HashNode *table [26], **temp, *item;
	int i;
	for (i = 0; i < 26; i++) {
		table[i] = NULL;
	}
	for (i = 0; i < MAX_FD_SIZE; i++) {
		temp = hash (header -> fd[i].fileName, table);
		*temp = addNode (header -> fd[i].fileName, *temp);
	}
}

void mount_vfs (struct VFS *header) {
	mountNArray (header);
	mountBST (header);
	mountHashTable (header);
}
